package com.yuhf.page;


import edu.yuhf.Constants;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;

import java.util.List;

@Data
@NoArgsConstructor
@RequiredArgsConstructor
public class Page<T> {
    @NonNull
    private int currentPage;
    private int rowNumber= Constants.ROW_NUMBER;
    private int totalRow;
    private int totalPage;
    private List<T> pageData;

    public void setTotalRow(int totalRow){
        this.totalRow=totalRow;
        totalPage = 0==totalRow%rowNumber?totalRow/rowNumber:totalRow/rowNumber+1;
    }

}
